<template>
  <view class="answer_info_container">
    <view class="inner-container">
      <view class="finish-btn" @click="showSubmitExamDialog">
        提交试卷
        <image src="../../static/blue_jiantou.png"
               style="width: 12upx;height: 16upx;margin-left: 10upx;margin-right: 24upx"></image>
      </view>
    </view>
  </view>
</template>

<script>
import questionCache from "@/libs/questionCache";

export default {
  name: 'ExamAnswerInfo',
  props: ['storeId'],
  data() {
    return {
      correctNum: 0,
      errorNum: 0,
    }
  },
  mounted() {
    questionCache.getStore(this.storeId).subscribe('answer', ({id, index, status}) => {
      if (status === 1) {
        this.correctNum++
      } else {
        this.errorNum++
      }
    })
  },
  methods: {
    showSubmitExamDialog() {
      questionCache.getStore(this.storeId).publish('submitExam')
    }
  }
}
</script>

<style scoped lang='scss'>
.answer_info_container {
  flex-direction: row;
  position: fixed;
  bottom: 158upx;
  height: 78upx;
  border-radius: 40upx;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;

  .inner-container {
    display: flex;
    height: 74upx;
    font-size: 13px;
    background-color: #fff;
    box-shadow: 0 2px 10px #0000001a;
    border-radius: 100rpx;
    padding: 0 30rpx;
    padding-left: 60rpx;
  }

  .finish-btn {
    display: flex;
    align-items: center;
    color: #3073F6;
  }
}
</style>
